From: emellor@ewan Date: Tue, 27 Sep 2005 14:06:40 +0000 (+0100) Subject: This patch adds a quick check in "xm save" to make sure the path given X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~16769^2~16^2~34 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=9427933f18c5d14ecb939c23627bea536e90e07c;p=xen.git This patch adds a quick check in "xm save" to make sure the path given exists, and is writable. This will fix the issue detected by xm-test 03_save_bogusfile_neg. Signed-off-by: Dan Smith Signed-off-by: Ewan Mellor --- diff --git a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py index acfd7047ee..0db2e8636d 100644 --- a/tools/python/xen/xm/main.py +++ b/tools/python/xen/xm/main.py @@ -175,6 +175,10 @@ def xm_save(args): dom = args[0] # TODO: should check if this exists savefile = os.path.abspath(args[1]) + + if not os.access(os.path.dirname(savefile), os.W_OK): + err("xm save: Unable to create file %s" % savefile) + sys.exit(1) from xen.xend.XendClient import server server.xend_domain_save(dom, savefile)